//
// Created by Lantz on 2024/6/9.
//

#include <iostream>
#include <bits/stdc++.h>

using namespace std;

double fastpower(int a, int n){
    if(a == 0) return 0;
    if(n <= 0) return 1;
    int x = fastpower(a, n / 2);
//    return n % 2 == 0 ? x * x : a * x * x;
    if (n % 2)
        return a * x * x;
    else
        return x * x;
}

int main(){

    int a = 3;
    int n = 10;
    double result = fastpower(a, n);
    cout<<result<<endl;

    return 0;
}